/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.cjb.malacma.rssfeed.util;

import java.util.HashMap;
import java.util.List;
import net.cjb.malacma.rssfeed.entity.FeedUrl;

/**
 *
 * @author malacma
 */
public class FeedCatalog {

    private static HashMap<String, FeedUrl> feedSet;
    

    static {
        feedSet = new HashMap<String, FeedUrl>();
        populate();
    }

    public static final void addFeed(FeedUrl url) {
        if (!feedSet.containsKey(url.getTitulo())) {
            feedSet.put(url.getTitulo(), url);
        }
    }

    public static final void populate() {
        List<FeedUrl> li = PersistenceUtil.findAllFeedUrl();
        for (FeedUrl fu : li) {
            addFeed(fu);
        }
    }

    public static final HashMap<String, FeedUrl> getInstance() {
        return feedSet;
    }

}


